<?php /* Smarty version Smarty-3.1.12, created on 2013-04-15 22:03:34
         compiled from "D:\wamp\www\acps_new\templates\protocol\timesheets.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1857512fba80047190-75365654%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '2cf78c473a018df5284c002ed248f3a76a626e4e' => 
    array (
      0 => 'D:\\wamp\\www\\acps_new\\templates\\protocol\\timesheets.tpl',
      1 => 1366063407,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1857512fba80047190-75365654',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.12',
  'unifunc' => 'content_512fba80048879_25506918',
  'variables' => 
  array (
    'data' => 0,
    'i' => 0,
    'month' => 0,
    'year' => 0,
    'filter' => 0,
    'value' => 0,
    'type' => 0,
    'tariff' => 0,
    'user' => 0,
    'client' => 0,
    'counter' => 0,
    'bgClass' => 0,
    'record' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_512fba80048879_25506918')) {function content_512fba80048879_25506918($_smarty_tpl) {?><script type="text/javascript">
    
        
    function showRecordForm(){
        var display = $(".inlineFormTr").css("display");
        if (display == 'none')
            if ($.browser.msie)
                $(".inlineFormTr").css("display", "block");
            else
                $(".inlineFormTr").css("display", "table-row");
        else
            $(".inlineFormTr").css("display", "none");
    }
        
    function sendAction(action){
        $("#action").val(action);
        $("#editing").submit();    
    }    
        
    function showOther(){
        var display = $("#otherTable").css("display");
        if (display == "none"){
            $("#other").empty();
            $("#other").append("- Other features of task");
            $("#otherTable").show();
            $("#showOther").val("1");
        } else {
            $("#other").empty();
            $("#other").append("+ Other features of task");
            $("#otherTable").hide();
            $("#showOther").val("0");
        }
    }
    
    function showTaskTypeTable(id){
        $("#taskType").removeClass("bgSpecial1");
        $(".external").hide();    
        if (id==8 || id==9){
            $("#taskType").addClass("bgSpecial1");
            $("#taskType"+id).show();
        }
    }
    
    function change_responsible(id){
        if (id!=""){
            $("#responsible option[value="+id+"]").attr("selected", "selected");
            $("#worker option[value="+id+"]").attr("selected", "selected");
        } else {
            $("#responsible option[value=-1]").attr("selected", "selected");
            $("#worker option[value=-1]").attr("selected", "selected");
        }
    }
        
    function changeTariffs(value, target){
        if (typeof(target) == 'undefined')
            target = 'rtariff';
        
        if (value!=-1){
            
            var data = {
                action : 'change_tariffs',
                params: {
                    type: value
                }
            }
                
            var result = false;

            ajax(data, function (data) {
                if (data.result==0){
                    $("#"+target).empty();
                    $("#"+target).append('<option value="-1">Please select</option>');
                    result = false;
                } else {
                    $("#"+target).empty();
                    $("#"+target).append('<option value="-1">Please select</option>');
                    $("#"+target).append(data.options)
                    result = true;
                }
            });

            return result;
            
        }
    }
        
    function fillPrice(value, target){
        if (typeof(target) == 'undefined')
            target = 'rprice';
        if (value!=-1){
            
            var data = {
                action : 'fill_price',
                params: {
                    tariff: value
                }
            }

            var result = false;

            ajax(data, function (data) {
                if (data.result==0){
                    $("#"+target).val("0.00");
                    result = false;
                } else {
                    $("#"+target).val(data.price);
                    makeFloat(".double",2);
                    result = true;
                }
            });

            return result;
            
        }
    }
        
    $(document).ready(function() {
        $("#created").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        });
        $("#deadline").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        });
        $("#date_of_action").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        }); 
        $("#delivery").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        }); 
        $(".float").change(function() {
            makeFloat(".float",1);
        });
        $("#rdate").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        });
        $("#rdate_edit").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        });
        $(".double").change(function() {
            makeFloat(".double",2);
        });
        $("#fulltext").keyup(function(event){
            if(event.keyCode == 13){
                setFulltext($('#fulltext').val(),'timesheets_fulltext')
            }
        });
    
    <?php if (isset($_REQUEST['add'])&&$_REQUEST['add']=='new'){?>
        
                showRecordForm();
        
    <?php }?>
    
        showTaskTypeTable(<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['type'];?>
);
        $("#rdate").focus();
    });
    
</script>
<h2 class="pageTitle">Timesheets</h2>
<?php echo $_smarty_tpl->getSubTemplate ($_smarty_tpl->tpl_vars['data']->value['pathToError'], $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<div class="menu-list">
    Month: 
    <select size="1" onchange="filter('month',this.value,'timesheets_filter')">
        <option value="-1">-</option>
        <?php  $_smarty_tpl->tpl_vars["month"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["month"]->_loop = false;
 $_smarty_tpl->tpl_vars["i"] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['months']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars["month"]->key => $_smarty_tpl->tpl_vars["month"]->value){
$_smarty_tpl->tpl_vars["month"]->_loop = true;
 $_smarty_tpl->tpl_vars["i"]->value = $_smarty_tpl->tpl_vars["month"]->key;
?>
            <option value="<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['month']->value;?>
</option>
        <?php } ?>
    </select>
    Year: 
    <select size="1" onchange="filter('year',this.value,'timesheets_filter')">
        <option value="-1">-</option>
        <?php  $_smarty_tpl->tpl_vars["year"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["year"]->_loop = false;
 $_smarty_tpl->tpl_vars["i"] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['years']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars["year"]->key => $_smarty_tpl->tpl_vars["year"]->value){
$_smarty_tpl->tpl_vars["year"]->_loop = true;
 $_smarty_tpl->tpl_vars["i"]->value = $_smarty_tpl->tpl_vars["year"]->key;
?>
            <option value="<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['year']->value;?>
</option>
        <?php } ?>
    </select>
    Fulltext search: <input id="fulltext" type="text" value="<?php if ($_smarty_tpl->tpl_vars['data']->value['currentFulltext']!=''){?><?php echo $_smarty_tpl->tpl_vars['data']->value['currentFulltext'];?>
<?php }?>" /><input value="Search" type="button" onclick="setFulltext($('#fulltext').val(),'timesheets_fulltext')" />
</div>
<?php if ($_smarty_tpl->tpl_vars['data']->value['currentFilter']||$_smarty_tpl->tpl_vars['data']->value['currentFulltext']!=''){?>
    <div class="menu-list bgDark">
        <b>Current filter:</b> 
        <ul>
            <?php  $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['value']->_loop = false;
 $_smarty_tpl->tpl_vars['filter'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['currentFilter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value){
$_smarty_tpl->tpl_vars['value']->_loop = true;
 $_smarty_tpl->tpl_vars['filter']->value = $_smarty_tpl->tpl_vars['value']->key;
?>
                <li><?php echo $_smarty_tpl->tpl_vars['filter']->value;?>
 = <i><?php echo $_smarty_tpl->tpl_vars['value']->value;?>
</i> [<a href="javascript: cancelFilter('<?php echo $_smarty_tpl->tpl_vars['filter']->value;?>
','timesheets_filter')" class="baseLink">Cancel</a>]</li>
            <?php } ?>
            <?php if ($_smarty_tpl->tpl_vars['data']->value['currentFulltext']!=''){?>
                <li>Fulltext = <i><?php echo $_smarty_tpl->tpl_vars['data']->value['currentFulltext'];?>
</i> [<a href="javascript: cancelFulltext('timesheets_fulltext')" class="baseLink">Cancel</a>]</li>
            <?php }?>
        </ul>
    </div>
<?php }?>

<?php if (isset($_REQUEST['add'])&&$_REQUEST['add']=='new'){?>
    <form class="adding" action="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=timesheets" method="post" onsubmit="return checkAdd_record(
                                                                    $('#rdate').val(), 
                                                                    $('#rclient').val(),
                                                                    $('#rtype').val(),
                                                                    $('#ramount').val(),
                                                                    $('#rprice').val(),
                                                                    $('#rdescription').val()
                                                                                   )">
        <table class="inlineForm bgGray">
            <tr>
                <th style="width: 80px" ></th>
                <th style="width: 150px" ></th>
                <th style="width: 120px"></th>
                <th style="width: 200px" ></th>
                <th style="width: 120px" ></th>
                <th style="width: 120px" ></th>
                <th style="width: 80px"></th>
                <th style="width: 80px"></th>
                <th style="width: 20px"></th>
                <th style="width: 20px"></th>
                <th style="width: 50px"></th>
                <th style="width: 50px"></th>
            </tr>
            <tr class="inlineFormTr" style="display: none">
                <td>
                    <input style="width: 80px" name="record[date]" id="rdate" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['prefill']['date'];?>
"/>
                </td>
                <td>
                    <select style="width: 150px" name="record[type]" id="rtype" size="1" onchange="changeTariffs(this.value)">
                        <option value="-1">Please select</option>
                        <?php  $_smarty_tpl->tpl_vars['type'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['type']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rtypes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['type']->key => $_smarty_tpl->tpl_vars['type']->value){
$_smarty_tpl->tpl_vars['type']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['type']->key;
?>
                            <option <?php if ($_smarty_tpl->tpl_vars['type']->value['Id']==$_smarty_tpl->tpl_vars['data']->value['prefill']['type']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['type']->value['Id'];?>
"><?php echo $_smarty_tpl->tpl_vars['type']->value['type_of_record'];?>
</option>
                        <?php } ?>
                    </select>
                </td>
                <td>
                    <select style="width: 120px" name="record[tariff]" id="rtariff" size="1" onchange="fillPrice(this.value)">
                        <option value="-1">Please select</option>
                        <?php  $_smarty_tpl->tpl_vars['tariff'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['tariff']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rtariffs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['tariff']->key => $_smarty_tpl->tpl_vars['tariff']->value){
$_smarty_tpl->tpl_vars['tariff']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['tariff']->key;
?>
                            <option <?php if ($_smarty_tpl->tpl_vars['tariff']->value['Id']==$_smarty_tpl->tpl_vars['data']->value['prefill']['tariff']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['tariff']->value['Id'];?>
"><?php echo $_smarty_tpl->tpl_vars['tariff']->value['title'];?>
</option>
                        <?php } ?>
                    </select>
                </td>
                <td>
                    <input style="width: 200px" name="record[description]" id="rdescription" type="text" value="<?php if ($_smarty_tpl->tpl_vars['data']->value['prefill']['description']){?><?php echo $_smarty_tpl->tpl_vars['data']->value['prefill']['description'];?>
<?php }?>"/>
                </td>
                <td>
                    <select style="width: 120px" name="record[user_id]" id="ruser_id" size="1" >
                        <?php  $_smarty_tpl->tpl_vars['user'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['user']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rusers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['user']->key => $_smarty_tpl->tpl_vars['user']->value){
$_smarty_tpl->tpl_vars['user']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['user']->key;
?>
                            <option <?php if ($_smarty_tpl->tpl_vars['data']->value['prefill']['user_id']==$_smarty_tpl->tpl_vars['user']->value['users_id']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['user']->value['users_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['user']->value['name'];?>
 <?php echo $_smarty_tpl->tpl_vars['user']->value['surname'];?>
</option>
                        <?php } ?>
                    </select>
                </td>
                <td>
                    <select style="width: 120px" name="record[client]" id="rclient" size="1" >
                        <option value="-1">Please select</option>
                        <?php  $_smarty_tpl->tpl_vars['client'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['client']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['clients']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['client']->key => $_smarty_tpl->tpl_vars['client']->value){
$_smarty_tpl->tpl_vars['client']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['client']->key;
?>
                            <option <?php if ($_SESSION['user']['user_type_id']!=@USER_TYPE_CLIENT&&$_smarty_tpl->tpl_vars['client']->value['bad_payer']==1){?>style="background: #ff545e"<?php }?> <?php if ($_smarty_tpl->tpl_vars['data']->value['prefill']['client']==$_smarty_tpl->tpl_vars['client']->value['klient_id']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['client']->value['klient_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['client']->value['name'];?>
</option>
                        <?php } ?>
                    </select>
                </td>
                <td>
                    <input style="width: 80px" name="record[amount]" id="ramount" class="float" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['prefill']['amount'];?>
"  />
                </td>
                <td>
                    <input style="width: 80px" name="record[price]" id="rprice" class="double" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['prefill']['unit_price'];?>
" />
                </td>
                <td></td>
                <td>
                    <input name="record[attention]" type="hidden" value="0" />
                    <input name="record[attention]" type="checkbox" value="1" <?php if ($_smarty_tpl->tpl_vars['data']->value['prefill']['attention']==1){?>checked="checked"<?php }?> />
                </td>
                <td>
                    <input name="action" value="add_record" type="hidden" />
                    <input type="submit" value="Save" name="add_record" />
                </td>
                <td></td>
            </tr>
            <tr>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
            </tr>
        </table>
    </form>
<?php }?>

<form action="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=timesheets" method="post" onsubmit="return checkAdd_record(
                                                                    $('#rdate_edit').val(), 
                                                                    $('#rclient_edit').val(),
                                                                    $('#rtype_edit').val(),
                                                                    $('#ramount_edit').val(),
                                                                    $('#rprice_edit').val(),
                                                                    $('#rdescription_edit').val()
                                                                                   )">
    <table class="list">
        <tr>
            <th style="width: 80px" ><a href="javascript: order('date','timesheets_order')"><label for="rdate">Date*</label> <?php if ($_smarty_tpl->tpl_vars['data']->value['currentOrder'][0]=="date"){?><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/<?php echo $_smarty_tpl->tpl_vars['data']->value['currentOrder'][1];?>
.png" height="14" width="14" /><?php }?></a></th>
            <th style="width: 150px" ><a href="javascript: order('type','timesheets_order')"><label for="rtype">Type of record*</label> <?php if ($_smarty_tpl->tpl_vars['data']->value['currentOrder'][0]=="type"){?><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/<?php echo $_smarty_tpl->tpl_vars['data']->value['currentOrder'][1];?>
.png" height="14" width="14" /><?php }?></a></th>
            <th style="width: 120px" ><a href="javascript: order('tariff','timesheets_order')"><label for="rtariff">Tariff</label> <?php if ($_smarty_tpl->tpl_vars['data']->value['currentOrder'][0]=="tariff"){?><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/<?php echo $_smarty_tpl->tpl_vars['data']->value['currentOrder'][1];?>
.png" height="14" width="14" /><?php }?></a></th>
            <th style="width: 200px" ><a href="javascript: order('description','timesheets_order')"><label for="rdescription">Description*</label> <?php if ($_smarty_tpl->tpl_vars['data']->value['currentOrder'][0]=="description"){?><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/<?php echo $_smarty_tpl->tpl_vars['data']->value['currentOrder'][1];?>
.png" height="14" width="14" /><?php }?></a></th>
            <th style="width: 120px" ><a href="javascript: order('user_id','timesheets_order')"><label for="rclient">Added by*</label> <?php if ($_smarty_tpl->tpl_vars['data']->value['currentOrder'][0]=="user_id"){?><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/<?php echo $_smarty_tpl->tpl_vars['data']->value['currentOrder'][1];?>
.png" height="14" width="14" /><?php }?></a></th>
            <th style="width: 120px" ><a href="javascript: order('client','timesheets_order')"><label for="rclient">Client*</label> <?php if ($_smarty_tpl->tpl_vars['data']->value['currentOrder'][0]=="client"){?><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/<?php echo $_smarty_tpl->tpl_vars['data']->value['currentOrder'][1];?>
.png" height="14" width="14" /><?php }?></a></th>
            <th style="width: 80px" ><a href="javascript: order('amount','timesheets_order')"><label for="ramount">Amount*</label> <?php if ($_smarty_tpl->tpl_vars['data']->value['currentOrder'][0]=="amount"){?><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/<?php echo $_smarty_tpl->tpl_vars['data']->value['currentOrder'][1];?>
.png" height="14" width="14" /><?php }?></a></th>
            <th style="width: 80px" ><a href="javascript: order('unit_price','timesheets_order')"><label for="rprice">Unit price*</label> <?php if ($_smarty_tpl->tpl_vars['data']->value['currentOrder'][0]=="unit_price"){?><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/<?php echo $_smarty_tpl->tpl_vars['data']->value['currentOrder'][1];?>
.png" height="14" width="14" /><?php }?></a></th>
            <th style="width: 20px"></th>
            <th style="width: 20px">!</th>
            <th style="width: 50px"></th>
            <th style="width: 50px"></th>
        </tr>
        <?php $_smarty_tpl->tpl_vars['counter'] = new Smarty_variable(1, null, 0);?>
        <?php  $_smarty_tpl->tpl_vars['record'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['record']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['records']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['record']->key => $_smarty_tpl->tpl_vars['record']->value){
$_smarty_tpl->tpl_vars['record']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['record']->key;
?>
            <?php if ($_smarty_tpl->tpl_vars['counter']->value==1){?>
                <?php $_smarty_tpl->tpl_vars['bgClass'] = new Smarty_variable('bgDark', null, 0);?>
            <?php }else{ ?>
                <?php $_smarty_tpl->tpl_vars['bgClass'] = new Smarty_variable('bgLight', null, 0);?>
            <?php }?>
            <tr class="<?php echo $_smarty_tpl->tpl_vars['bgClass']->value;?>
">
                <?php if ($_smarty_tpl->tpl_vars['counter']->value==1){?>
                    <?php $_smarty_tpl->tpl_vars['counter'] = new Smarty_variable(2, null, 0);?>
                <?php }else{ ?>
                    <?php $_smarty_tpl->tpl_vars['counter'] = new Smarty_variable(1, null, 0);?>
                <?php }?>
                <?php if (isset($_REQUEST['editRecord'])&&$_REQUEST['editRecord']==$_smarty_tpl->tpl_vars['record']->value['recordId']){?>
                    <td>
                        <input style="width: 80px" name="record[date]" id="rdate_edit" type="text" value="<?php echo $_smarty_tpl->tpl_vars['record']->value['date_formated'];?>
"/>
                    </td>
                    <td>
                        <select style="width: 120px" name="record[type]" id="rtype_edit" size="1" onchange="changeTariffs(this.value,'rtariff_edit')">
                            <option value="-1">Please select</option>
                            <?php  $_smarty_tpl->tpl_vars['type'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['type']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rtypes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['type']->key => $_smarty_tpl->tpl_vars['type']->value){
$_smarty_tpl->tpl_vars['type']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['type']->key;
?>
                                <option <?php if ($_smarty_tpl->tpl_vars['type']->value['Id']==$_smarty_tpl->tpl_vars['record']->value['type']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['type']->value['Id'];?>
"><?php echo $_smarty_tpl->tpl_vars['type']->value['type_of_record'];?>
</option>
                            <?php } ?>
                        </select>
                    </td>
                    <td>
                        <select style="width: 120px" name="record[tariff]" id="rtariff_edit" size="1" onchange="fillPrice(this.value,'rprice_edit')">
                            <option value="-1">Please select</option>
                            <?php  $_smarty_tpl->tpl_vars['tariff'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['tariff']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rtariffs_edit']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['tariff']->key => $_smarty_tpl->tpl_vars['tariff']->value){
$_smarty_tpl->tpl_vars['tariff']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['tariff']->key;
?>
                                <option <?php if ($_smarty_tpl->tpl_vars['tariff']->value['Id']==$_smarty_tpl->tpl_vars['record']->value['tariff']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['tariff']->value['Id'];?>
"><?php echo $_smarty_tpl->tpl_vars['tariff']->value['title'];?>
</option>
                            <?php } ?>
                        </select>
                    </td>
                    <td>
                        <input style="width: 200px" name="record[description]" id="rdescription_edit" type="text" value="<?php echo $_smarty_tpl->tpl_vars['record']->value['description'];?>
"/>
                    </td>
                    <td>
                        <select style="width: 150px" name="record[user_id]" id="ruser_id_edit" size="1" >
                            <?php  $_smarty_tpl->tpl_vars['user'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['user']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rusers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['user']->key => $_smarty_tpl->tpl_vars['user']->value){
$_smarty_tpl->tpl_vars['user']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['user']->key;
?>
                                <option <?php if ($_smarty_tpl->tpl_vars['record']->value['user_id']==$_smarty_tpl->tpl_vars['user']->value['users_id']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['user']->value['users_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['user']->value['name'];?>
 <?php echo $_smarty_tpl->tpl_vars['user']->value['surname'];?>
</option>
                            <?php } ?>
                        </select>
                    </td>
                    <td>
                        <select style="width: 150px" name="record[client]" id="rclient_edit" size="1" >
                            <option value="-1">Please select</option>
                            <?php  $_smarty_tpl->tpl_vars['client'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['client']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['clients']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['client']->key => $_smarty_tpl->tpl_vars['client']->value){
$_smarty_tpl->tpl_vars['client']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['client']->key;
?>
                                <option <?php if ($_SESSION['user']['user_type_id']!=@USER_TYPE_CLIENT&&$_smarty_tpl->tpl_vars['client']->value['bad_payer']==1){?>style="background: #ff545e"<?php }?> <?php if ($_smarty_tpl->tpl_vars['record']->value['client']==$_smarty_tpl->tpl_vars['client']->value['klient_id']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['client']->value['klient_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['client']->value['name'];?>
</option>
                            <?php } ?>
                        </select>
                    </td>
                    <td>
                        <input style="width: 80px" name="record[amount]" id="ramount_edit" class="float" type="text" value="<?php echo $_smarty_tpl->tpl_vars['record']->value['amount'];?>
"  />
                    </td>
                    <td>
                        <input style="width: 80px" name="record[price]" id="rprice_edit" class="double" type="text" value="<?php echo $_smarty_tpl->tpl_vars['record']->value['unit_price'];?>
" />
                    </td>
                    <td></td>
                    <td>
                        <input name="record[attention]" type="hidden" value="0" />
                        <input name="record[attention]" type="checkbox" value="1" <?php if ($_smarty_tpl->tpl_vars['record']->value['attention']==1){?>checked="checked"<?php }?> />
                    </td>
                    <td>
                        <input name="recordId" value="<?php echo $_smarty_tpl->tpl_vars['record']->value['recordId'];?>
" type="hidden" />
                        <input name="action" value="edit_record" type="hidden" />
                        <input type="submit" value="Save" name="add_record" />
                    </td>
                    <td></td>
                <?php }else{ ?>
                    <td><a class="filterLink" href="javascript: filter('date','<?php echo $_smarty_tpl->tpl_vars['record']->value['date'];?>
','timesheets_filter')"><?php echo $_smarty_tpl->tpl_vars['record']->value['date_formated'];?>
</a></td>
                    <td><a class="filterLink" href="javascript: filter('type','<?php echo $_smarty_tpl->tpl_vars['record']->value['type'];?>
','timesheets_filter')"><?php echo $_smarty_tpl->tpl_vars['record']->value['type_info']['type_of_record'];?>
</a></td>
                    <td><a class="filterLink" href="javascript: filter('tariff','<?php echo $_smarty_tpl->tpl_vars['record']->value['tariff'];?>
','timesheets_filter')"><?php echo $_smarty_tpl->tpl_vars['record']->value['tariff_info']['title'];?>
</a></td>
                    <td><a class="filterLink" href="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=timesheets&editRecord=<?php echo $_smarty_tpl->tpl_vars['record']->value['recordId'];?>
"><?php echo $_smarty_tpl->tpl_vars['record']->value['description'];?>
</a></td>
                    <td><a class="filterLink" href="javascript: filter('user_id','<?php echo $_smarty_tpl->tpl_vars['record']->value['user_id'];?>
','timesheets_filter')"><?php echo $_smarty_tpl->tpl_vars['record']->value['user_info']['name'];?>
 <?php echo $_smarty_tpl->tpl_vars['record']->value['user_info']['surname'];?>
</a></td>
                    <td><a class="filterLink" href="javascript: filter('client','<?php echo $_smarty_tpl->tpl_vars['record']->value['client'];?>
','timesheets_filter')"><?php echo $_smarty_tpl->tpl_vars['record']->value['client_info']['name'];?>
</a></td>
                    <td><a class="filterLink" href="javascript: filter('amount','<?php echo $_smarty_tpl->tpl_vars['record']->value['amount'];?>
','timesheets_filter')"><?php echo $_smarty_tpl->tpl_vars['record']->value['amount'];?>
</a></td>
                    <td><a class="filterLink" href="javascript: filter('unit_price','<?php echo $_smarty_tpl->tpl_vars['record']->value['unit_price'];?>
','timesheets_filter')"><?php echo $_smarty_tpl->tpl_vars['record']->value['unit_price'];?>
</a></td>
                    <td>
                        <?php if ($_smarty_tpl->tpl_vars['record']->value['taskId']!=0){?>
                            <a href="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=edit_task&amp;task=<?php echo $_smarty_tpl->tpl_vars['record']->value['taskId'];?>
" title="to task">
                                <img height="10" width="10" src="<?php echo @PATH_TO_IMAGES;?>
arrow.png" title="to task" alt="to task" />
                            </a>
                        <?php }?>
                    </td>
                    <td>
                        <?php if ($_smarty_tpl->tpl_vars['record']->value['attention']==1){?>
                            <a class="filterLink" href="javascript: filter('attention','1','timesheets_filter')">
                                <img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/attention.png" height="16" width="16" />
                            </a>
                        <?php }?>    
                    </td>
                    <td>
                        <a href="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=timesheets&amp;add=new&amp;copy_id=<?php echo $_smarty_tpl->tpl_vars['record']->value['recordId'];?>
">
                            <img height="16" width="16" src="<?php echo @PATH_TO_IMAGES;?>
copy.png" />
                        </a>
                    </td>
                    <td style="">
                        <a href="javascript: deleteRecord(<?php echo $_smarty_tpl->tpl_vars['record']->value['recordId'];?>
)">
                            <img height="16" width="16" src="<?php echo @PATH_TO_IMAGES;?>
delete.png" />
                        </a>
                    </td>
                <?php }?>
            </tr>
        <?php } ?>
    </table>
</form>
<div class="menu-list">
    <span class="pager"><?php echo $_smarty_tpl->tpl_vars['data']->value['pager'];?>
</span>
    Records per page
    <select class="pager" size="1" onchange="changeRecordsPerPage(this.value, 'timesheets_pager')">
        <option <?php if ($_SESSION['timesheets_pager']==20){?>selected="selected"<?php }?> value="20">20</option>
        <option <?php if ($_SESSION['timesheets_pager']==50){?>selected="selected"<?php }?> value="50">50</option>
        <option <?php if ($_SESSION['timesheets_pager']==100){?>selected="selected"<?php }?> value="100">100</option>
        <option <?php if ($_SESSION['timesheets_pager']==200){?>selected="selected"<?php }?> value="200">200</option>
    </select>
    
</div><?php }} ?>